package com.ece.friendly.jdbcConnection;

import java.sql.Connection;
import java.sql.DriverManager;

import com.mysql.jdbc.Statement;

public class JdbcConnection{
	private Connection connection;
	private Statement stat;
	public JdbcConnection(){
        
        try {
        	String url="jdbc:mysql://localhost/friendly";
        	String user="root";
        	String passwd="root";
        	
            Class.forName("com.mysql.jdbc.Driver");
            System.out.println("DRIVER OK ! ");
            
            connection = DriverManager.getConnection(url,user, passwd);
            connection.setAutoCommit(false);
            setStat((Statement) connection.createStatement());
            System.out.println("Connection effective !");            
            
        } catch (Exception e) {
            e.printStackTrace();
        } 
    }
	
	public Connection getConnection() {
		return connection;
	}
	public void setConnection(Connection connection) {
		this.connection = connection;
	}

	public Statement getStat() {
		return stat;
	}

	public void setStat(Statement stat) {
		this.stat = stat;
	}
}
